home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / mus / misc / ledv1_00.lha / led.c < prev    next >
C/C++ Source or Header  |  1995-01-26  |  2KB  |  76 lines

  1. /************************
  2. ** LED/Filter switcher **
  3. ** V1.0                **
  4. ************************/
  5.  
  6. #include <exec/exec.h>
  7. #include <exec/lists.h>
  8. #include <exec/memory.h>
  9. #include <exec/nodes.h>
  10. #include <exec/types.h>
  11. #include <math.h>
  12. #include <stdlib.h>
  13. #include <stdio.h>
  14. #include <string.h>
  15. #include <time.h>
  16.  
  17. /* die entsprechenden Matheroutinen includen */
  18.  
  19. #ifdef _M68881
  20.     #include <m68881.h>
  21. #endif
  22.  
  23. /* Prototypes für Libraryfunctions */
  24.  
  25. #include <proto/exec.h>
  26.  
  27. /* Version | Revisionscontrol */
  28.  
  29. #define    VERSION        1
  30. #define    REVISION    00
  31. #define    DATE        "__Date__"
  32. #define    VERS        "Led 1.00"
  33. #define    VSTRING        "Led 1.00 ("__DATE__")\n\r"
  34. #define    VERSTAG        "\0$VER: Led 1.00 ("__DATE__")"
  35.  
  36. /* Globals */
  37.  
  38. UBYTE VersTag[]    =VERSTAG;                /* Versionsstring */
  39. UBYTE *PRA        =(UBYTE *)0xbfe001;        /* u.a. LED/Filter */
  40.  
  41. UBYTE main(int argc,char *argv[])
  42. {
  43.     UBYTE ret=0;
  44.  
  45.     printf("\nLed V1.0\nby ENSONIC of TRINOMIC\n\n");
  46.     if(argc!=2)
  47.     {
  48.         printf("Usage : led command\n");
  49.         printf("\tstatus :\n");
  50.         printf("\t\t0 : off\n");
  51.         printf("\t\t1 : on\n");
  52.         printf("\t\t2 : toggle\n");
  53.         printf("\t\t3 : status\n");
  54.         exit(0);
  55.     }
  56.     switch(atoi(argv[1]))
  57.     {
  58.         case 0:        /* off */
  59.             *PRA|=(UBYTE)2;            /* OR - setzen */
  60.             ret=5;
  61.             break;
  62.         case 1:        /* On */
  63.             *PRA&=(UBYTE)65533;        /* AND - ausmaskieren */
  64.             ret=0;
  65.             break;
  66.         case 2:
  67.             *PRA^=(UBYTE)2;            /* XOR - toggeln */
  68.             ret=5-(5*((*PRA)&2)>>1);
  69.             break;
  70.         case 3:                        /* AND - abfragen */
  71.             ret=5-(5*((*PRA)&2)>>1);
  72.             break;
  73.     }
  74.     return(ret);
  75. }
  76.